﻿using System;
using System.Windows.Forms;

namespace MediaController.Utils.UI
{
    public class ProgressColumn : DataGridViewColumn
    {
        public ProgressColumn()
            : base(new ProgressCell())
        {
        }

        public override DataGridViewCell CellTemplate
        {
            get { return base.CellTemplate; }
            set
            {
                // Ensure that the cell used for the template is a ProgressCell.
                if (value != null && !value.GetType().IsAssignableFrom(typeof(ProgressCell)))
                {
                    throw new InvalidCastException("Must be a ProgressCell");
                }
                base.CellTemplate = value;
            }
        }
    }
}